In addition to providing basic forwarding functions such as switching and routing, a general network device may further provide a value-added service (VAS). For example, the VAS may be a service such as network address translation (NAT) or a firewall.
In a network that provides a value-added service, a service chain (service chain) includes a service classifier (service classifier) and N service forwarding entities (SFE). The SFEs included in the service chain are successively connected. The SFE may be connected to one or more service function (SF) nodes. According to a service to which a received packet belongs, the service classifier adds an identifier of the service chain to the packet, to obtain a service packet. The service classifier sends the service packet to an SFE connected to the service classifier. The SFE sends the received service packet to an SF node that is connected to the SFE and that belongs to the service chain, and the SF node performs service processing on the service packet.
To implement normal forwarding of the service packet, a detection device in the network may detect whether the SFE, the SF node, and the service classifier can forward the service packet. When the SFE can forward the service packet to the SF node that is connected to the SFE and that belongs to the service chain, the detection device cannot detect whether an order in which the SFE forwards the service packet to an SF node belonging to the service chain is correct, that is, the detection device cannot learn an SF node that the service packet passes through when being forwarded on the service chain.